<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/xhtml;charset=utf-8" http-equiv="Content-Type"/>
<meta content="IE=9" http-equiv="X-UA-Compatible"/>
<meta content="Doxygen 1.8.13" name="generator"/>
<title>OpenCV: Superpixels</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script src="../../jquery.js" type="text/javascript"></script>
<script src="../../dynsections.js" type="text/javascript"></script>
<script src="../../tutorial-utils.js" type="text/javascript"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script src="../../search/searchdata.js" type="text/javascript"></script>
<script src="../../search/search.js" type="text/javascript"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js" type="text/javascript"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellpadding="0" cellspacing="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
    <span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script src="../../menudata.js" type="text/javascript"></script>
<script src="../../menu.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow" onkeydown="return searchBox.OnSearchSelectKey(event)" onmouseout="return searchBox.OnSearchSelectHide()" onmouseover="return searchBox.OnSearchSelectShow()">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe frameborder="0" id="MSearchResults" name="MSearchResults" src="javascript:void(0)">
</iframe>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Superpixels<div class="ingroups"><a class="el" href="../../df/d2d/group__ximgproc.html">Extended Image Processing</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td align="right" class="memItemLeft" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/da0/classcv_1_1ximgproc_1_1SuperpixelLSC.html">cv::ximgproc::SuperpixelLSC</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Class implementing the LSC (Linear Spectral Clustering) superpixels algorithm described in <a class="el" href="../../d0/de3/citelist.html#CITEREF_LiCVPR2015LSC">[142]</a>.  <a href="../../d5/da0/classcv_1_1ximgproc_1_1SuperpixelLSC.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td align="right" class="memItemLeft" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d81/classcv_1_1ximgproc_1_1SuperpixelSEEDS.html">cv::ximgproc::SuperpixelSEEDS</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm described in <a class="el" href="../../d0/de3/citelist.html#CITEREF_VBRV14">[257]</a> .  <a href="../../df/d81/classcv_1_1ximgproc_1_1SuperpixelSEEDS.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td align="right" class="memItemLeft" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/da9/classcv_1_1ximgproc_1_1SuperpixelSLIC.html">cv::ximgproc::SuperpixelSLIC</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in <a class="el" href="../../d0/de3/citelist.html#CITEREF_Achanta2012">[1]</a>.  <a href="../../d3/da9/classcv_1_1ximgproc_1_1SuperpixelSLIC.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga6c6f7deab0bd328066f0ada72c2ce57b"><td align="right" class="memItemLeft" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#ga6c6f7deab0bd328066f0ada72c2ce57b">cv::ximgproc::SLICType</a> { <br/>
  <a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#gga6c6f7deab0bd328066f0ada72c2ce57ba14bff8b90df89890367525f0de4f3409">cv::ximgproc::SLIC</a> = 100, 
<br/>
  <a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#gga6c6f7deab0bd328066f0ada72c2ce57ba9b397d2eb2d75580b3a481bf8e0edef1">cv::ximgproc::SLICO</a> = 101, 
<br/>
  <a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#gga6c6f7deab0bd328066f0ada72c2ce57ba7f820d4b97c57b9d42dfa862a8ab347a">cv::ximgproc::MSLIC</a> = 102
<br/>
 }</td></tr>
<tr class="separator:ga6c6f7deab0bd328066f0ada72c2ce57b"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga437341bd2bc5c7a9806450063fd5c5a3"><td align="right" class="memItemLeft" valign="top"><a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; <a class="el" href="../../d5/da0/classcv_1_1ximgproc_1_1SuperpixelLSC.html">SuperpixelLSC</a> &gt; </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#ga437341bd2bc5c7a9806450063fd5c5a3">cv::ximgproc::createSuperpixelLSC</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> image, int region_size=10, float ratio=0.075f)</td></tr>
<tr class="memdesc:ga437341bd2bc5c7a9806450063fd5c5a3"><td class="mdescLeft"> </td><td class="mdescRight">Class implementing the LSC (Linear Spectral Clustering) superpixels.  <a href="../../df/d6c/group__ximgproc__superpixel.html#ga437341bd2bc5c7a9806450063fd5c5a3">More...</a><br/></td></tr>
<tr class="separator:ga437341bd2bc5c7a9806450063fd5c5a3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gabda19d839f775cbb527fffec133bc4ea"><td align="right" class="memItemLeft" valign="top"><a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; <a class="el" href="../../df/d81/classcv_1_1ximgproc_1_1SuperpixelSEEDS.html">SuperpixelSEEDS</a> &gt; </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#gabda19d839f775cbb527fffec133bc4ea">cv::ximgproc::createSuperpixelSEEDS</a> (int image_width, int image_height, int image_channels, int num_superpixels, int num_levels, int prior=2, int histogram_bins=5, bool double_step=false)</td></tr>
<tr class="memdesc:gabda19d839f775cbb527fffec133bc4ea"><td class="mdescLeft"> </td><td class="mdescRight">Initializes a <a class="el" href="../../df/d81/classcv_1_1ximgproc_1_1SuperpixelSEEDS.html" title="Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm...">SuperpixelSEEDS</a> object.  <a href="../../df/d6c/group__ximgproc__superpixel.html#gabda19d839f775cbb527fffec133bc4ea">More...</a><br/></td></tr>
<tr class="separator:gabda19d839f775cbb527fffec133bc4ea"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gacf29df20eaca242645a8d3a2d88e6c06"><td align="right" class="memItemLeft" valign="top"><a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt; <a class="el" href="../../d3/da9/classcv_1_1ximgproc_1_1SuperpixelSLIC.html">SuperpixelSLIC</a> &gt; </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#gacf29df20eaca242645a8d3a2d88e6c06">cv::ximgproc::createSuperpixelSLIC</a> (<a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> image, int algorithm=<a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#gga6c6f7deab0bd328066f0ada72c2ce57ba9b397d2eb2d75580b3a481bf8e0edef1">SLICO</a>, int region_size=10, float ruler=10.0f)</td></tr>
<tr class="memdesc:gacf29df20eaca242645a8d3a2d88e6c06"><td class="mdescLeft"> </td><td class="mdescRight">Initialize a <a class="el" href="../../d3/da9/classcv_1_1ximgproc_1_1SuperpixelSLIC.html" title="Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in ...">SuperpixelSLIC</a> object.  <a href="../../df/d6c/group__ximgproc__superpixel.html#gacf29df20eaca242645a8d3a2d88e6c06">More...</a><br/></td></tr>
<tr class="separator:gacf29df20eaca242645a8d3a2d88e6c06"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a id="details" name="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga6c6f7deab0bd328066f0ada72c2ce57b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6c6f7deab0bd328066f0ada72c2ce57b">◆ </a></span>SLICType</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#ga6c6f7deab0bd328066f0ada72c2ce57b">cv::ximgproc::SLICType</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../df/d2b/slic_8hpp.html">opencv2/ximgproc/slic.hpp</a>&gt;</code></p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga6c6f7deab0bd328066f0ada72c2ce57ba14bff8b90df89890367525f0de4f3409"></a>SLIC <div class="python_language">Python: cv.ximgproc.SLIC</div></td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="gga6c6f7deab0bd328066f0ada72c2ce57ba9b397d2eb2d75580b3a481bf8e0edef1"></a>SLICO <div class="python_language">Python: cv.ximgproc.SLICO</div></td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="gga6c6f7deab0bd328066f0ada72c2ce57ba7f820d4b97c57b9d42dfa862a8ab347a"></a>MSLIC <div class="python_language">Python: cv.ximgproc.MSLIC</div></td><td class="fielddoc"></td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga437341bd2bc5c7a9806450063fd5c5a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga437341bd2bc5c7a9806450063fd5c5a3">◆ </a></span>createSuperpixelLSC()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt;<a class="el" href="../../d5/da0/classcv_1_1ximgproc_1_1SuperpixelLSC.html">SuperpixelLSC</a>&gt; cv::ximgproc::createSuperpixelLSC </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>region_size</em> = <code>10</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float </td>
          <td class="paramname"><em>ratio</em> = <code>0.075f</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.ximgproc.createSuperpixelLSC(</td><td class="paramname">image[, region_size[, ratio]]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../da/d29/lsc_8hpp.html">opencv2/ximgproc/lsc.hpp</a>&gt;</code></p>
<p>Class implementing the LSC (Linear Spectral Clustering) superpixels. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">image</td><td>Image to segment </td></tr>
    <tr><td class="paramname">region_size</td><td>Chooses an average superpixel size measured in pixels </td></tr>
    <tr><td class="paramname">ratio</td><td>Chooses the enforcement of superpixel compactness factor of superpixel</td></tr>
  </table>
  </dd>
</dl>
<p>The function initializes a <a class="el" href="../../d5/da0/classcv_1_1ximgproc_1_1SuperpixelLSC.html" title="Class implementing the LSC (Linear Spectral Clustering) superpixels algorithm described in ...">SuperpixelLSC</a> object for the input image. It sets the parameters of superpixel algorithm, which are: region_size and ruler. It preallocate some buffers for future computing iterations over the given image. An example of LSC is ilustrated in the following picture. For enanched results it is recommended for color images to preprocess image with little gaussian blur with a small 3 x 3 kernel and additional conversion into CieLAB color space.</p>
<div class="image">
<img alt="superpixels_lsc.png" src="../../superpixels_lsc.png"/>
<div class="caption">
image</div></div>
</div>
</div>
<a id="gabda19d839f775cbb527fffec133bc4ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabda19d839f775cbb527fffec133bc4ea">◆ </a></span>createSuperpixelSEEDS()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt;<a class="el" href="../../df/d81/classcv_1_1ximgproc_1_1SuperpixelSEEDS.html">SuperpixelSEEDS</a>&gt; cv::ximgproc::createSuperpixelSEEDS </td>
          <td>(</td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>image_width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>image_height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>image_channels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>num_superpixels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>num_levels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>prior</em> = <code>2</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>histogram_bins</em> = <code>5</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool </td>
          <td class="paramname"><em>double_step</em> = <code>false</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.ximgproc.createSuperpixelSEEDS(</td><td class="paramname">image_width, image_height, image_channels, num_superpixels, num_levels[, prior[, histogram_bins[, double_step]]]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d5/daf/seeds_8hpp.html">opencv2/ximgproc/seeds.hpp</a>&gt;</code></p>
<p>Initializes a <a class="el" href="../../df/d81/classcv_1_1ximgproc_1_1SuperpixelSEEDS.html" title="Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm...">SuperpixelSEEDS</a> object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">image_width</td><td>Image width. </td></tr>
    <tr><td class="paramname">image_height</td><td>Image height. </td></tr>
    <tr><td class="paramname">image_channels</td><td>Number of channels of the image. </td></tr>
    <tr><td class="paramname">num_superpixels</td><td>Desired number of superpixels. Note that the actual number may be smaller due to restrictions (depending on the image size and num_levels). Use getNumberOfSuperpixels() to get the actual number. </td></tr>
    <tr><td class="paramname">num_levels</td><td>Number of block levels. The more levels, the more accurate is the segmentation, but needs more memory and CPU time. </td></tr>
    <tr><td class="paramname">prior</td><td>enable 3x3 shape smoothing term if &gt;0. A larger value leads to smoother shapes. prior must be in the range [0, 5]. </td></tr>
    <tr><td class="paramname">histogram_bins</td><td>Number of histogram bins. </td></tr>
    <tr><td class="paramname">double_step</td><td>If true, iterate each block level twice for higher accuracy.</td></tr>
  </table>
  </dd>
</dl>
<p>The function initializes a <a class="el" href="../../df/d81/classcv_1_1ximgproc_1_1SuperpixelSEEDS.html" title="Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm...">SuperpixelSEEDS</a> object for the input image. It stores the parameters of the image: image_width, image_height and image_channels. It also sets the parameters of the SEEDS superpixel algorithm, which are: num_superpixels, num_levels, use_prior, histogram_bins and double_step.</p>
<p>The number of levels in num_levels defines the amount of block levels that the algorithm use in the optimization. The initialization is a grid, in which the superpixels are equally distributed through the width and the height of the image. The larger blocks correspond to the superpixel size, and the levels with smaller blocks are formed by dividing the larger blocks into 2 x 2 blocks of pixels, recursively until the smaller block level. An example of initialization of 4 block levels is illustrated in the following figure.</p>
<div class="image">
<img alt="superpixels_blocks.png" src="../../superpixels_blocks.png"/>
<div class="caption">
image</div></div>
</div>
</div>
<a id="gacf29df20eaca242645a8d3a2d88e6c06"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacf29df20eaca242645a8d3a2d88e6c06">◆ </a></span>createSuperpixelSLIC()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="../../dc/d84/group__core__basic.html#ga6395ca871a678020c4a31fadf7e8cc63">Ptr</a>&lt;<a class="el" href="../../d3/da9/classcv_1_1ximgproc_1_1SuperpixelSLIC.html">SuperpixelSLIC</a>&gt; cv::ximgproc::createSuperpixelSLIC </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="../../dc/d84/group__core__basic.html#ga353a9de602fe76c709e12074a6f362ba">InputArray</a> </td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>algorithm</em> = <code><a class="el" href="../../df/d6c/group__ximgproc__superpixel.html#gga6c6f7deab0bd328066f0ada72c2ce57ba9b397d2eb2d75580b3a481bf8e0edef1">SLICO</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int </td>
          <td class="paramname"><em>region_size</em> = <code>10</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float </td>
          <td class="paramname"><em>ruler</em> = <code>10.0f</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>retval</td><td>=</td><td>cv.ximgproc.createSuperpixelSLIC(</td><td class="paramname">image[, algorithm[, region_size[, ruler]]]</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../df/d2b/slic_8hpp.html">opencv2/ximgproc/slic.hpp</a>&gt;</code></p>
<p>Initialize a <a class="el" href="../../d3/da9/classcv_1_1ximgproc_1_1SuperpixelSLIC.html" title="Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in ...">SuperpixelSLIC</a> object. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">image</td><td>Image to segment </td></tr>
    <tr><td class="paramname">algorithm</td><td>Chooses the algorithm variant to use: SLIC segments image using a desired region_size, and in addition SLICO will optimize using adaptive compactness factor, while MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels. </td></tr>
    <tr><td class="paramname">region_size</td><td>Chooses an average superpixel size measured in pixels </td></tr>
    <tr><td class="paramname">ruler</td><td>Chooses the enforcement of superpixel smoothness factor of superpixel</td></tr>
  </table>
  </dd>
</dl>
<p>The function initializes a <a class="el" href="../../d3/da9/classcv_1_1ximgproc_1_1SuperpixelSLIC.html" title="Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in ...">SuperpixelSLIC</a> object for the input image. It sets the parameters of choosed superpixel algorithm, which are: region_size and ruler. It preallocate some buffers for future computing iterations over the given image. For enanched results it is recommended for color images to preprocess image with little gaussian blur using a small 3 x 3 kernel and additional conversion into CieLAB color space. An example of SLIC versus SLICO and MSLIC is ilustrated in the following picture.</p>
<div class="image">
<img alt="superpixels_slic.png" src="../../superpixels_slic.png"/>
<div class="caption">
image</div></div>
</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:42 for OpenCV by  <a href="http://www.doxygen.org/index.html">
<img alt="doxygen" class="footer" src="../../doxygen.png"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
